package com.avalon.core.model;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.io.Serializable;
import java.util.ArrayList;

@JsonSerialize(using = RecordSerializer.class)
public class Record extends ArrayList<RecordRow> implements Serializable {

    public void putAll(String fieldName, Object value) {

        this.forEach((row) -> {
            row.put(fieldName, value);
        });
    }

    /**
     * 创建record
     *
     * @return record
     */
    public static Record build() {
        return new Record();
    }

    /**
     * 合并record
     *
     * @param record
     */
    public void join(Record record) {
        this.addAll(record);
    }
}
